Repository navigation
Uninstall and install for every user, not only this one - #136
Open
JingMatrix wants to merge 2 commits into
Open
JingMatrix wants to merge 2 commits into
JingMatrix wants to merge 2 commits into
Conversation
A package has one apk and one certificate for the whole device, while the installed bit is per user. An app left behind in a second user or a work profile keeps its certificate on record, and the next install of a differently signed build — which every patched build is — is refused with INSTALL_FAILED_UPDATE_INCOMPATIBLE, after the manager has asked for an uninstall and the data is already gone. So the Shizuku uninstall passes DELETE_ALL_USERS through the hidden flagged overload, reflectively, and falls back to the single-user call where a platform has none; the shell install sets INSTALL_ALL_USERS, so the patched build replaces the app wherever it was. The platform installer has no such flag, so there the uninstall says what it could not do and names pm uninstall as the way out, rather than report a success the install then contradicts. Whether to ask at all needs evidence an unprivileged app does not have: a package installed in another user and not in this one answers nothing, MATCH_UNINSTALLED_PACKAGES included. The installed app's own apk paths stand in. They point into /data/app, which lives exactly as long as some user still has the package, and the certificate is read from the file there. Also here: the prompt and the effect line say every user, in all thirty languages.
The sentence a surviving record produces is what the failure screen puts in front of the reader, so it is a string resource like the rest of what the app says, translated with the prompt it follows. Restoring an original over a patched app installs a differently signed build just as a patch does, so that path hands the installed apks over as well; without them it would uninstall for this user, report success, and leave the install to fail. One accessor on PatchTarget answers which paths are the package manager's, for both callers and the keystore warning. Also here: the surviving record is looked for only after an uninstall that reported success — on any other outcome the apk read would name a survivor for a package nothing has removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A package has one apk and one certificate for the whole device, while the installed bit is per user. An app that is also in a second user or a work profile therefore survives a single-user uninstall with its certificate still on record, and the install it was uninstalled for — a patched build, so differently signed — is refused with a bare
INSTALL_FAILED_UPDATE_INCOMPATIBLE. The user has by then lost the app's data for nothing.Three changes close it:
DELETE_ALL_USERS, through the flaggeduninstalloverload that is hidden rather than absent, so it is called reflectively; a platform without it falls back to the single-user call.INSTALL_ALL_USERS, so the patched build replaces the app in every user that had it instead of landing in the primary one and leaving the others without the app they had.pm uninstallas the way out, rather than reporting a success the install then contradicts.Deciding whether to ask for an uninstall at all needs evidence an unprivileged app does not have: a package installed in another user and not in this one answers nothing,
MATCH_UNINSTALLED_PACKAGESincluded — measured on Android 16. The installed app's own apk paths stand in for it. They come from the package manager at a moment the app was visible here, they point into/data/app, and that directory lives exactly as long as some user still has the package, so the certificate can be read from the file.The prompt and the effect line now say every user, and the thirty translations say it too.